/**
 * Created by Cake on 2017/10/9.
 */

var bannerAutoSize = function () {
    var banner = $(".banner"),
        scale = accDiv(600, 750),
        width = $(window).width(),
        height = accMul(width, scale);

    banner.height(height);
};

var drawAutoSize = function () {
    var banner = $(".banner-draw"),
        scale = accDiv(515, 750),
        width = $(window).width(),
        height = accMul(width, scale);

    banner.height(height);
};

$(function () {
    var banner = new Swiper('.banner', {
        pagination: '.swiper-pagination',
        speed: 400,
        autoplay: 3000,
        autoplayDisableOnInteraction: false,
        loop: true,
        onInit: function () {
            bannerAutoSize();
        },
        onAfterResize: function () {
            bannerAutoSize();
        }
    });


    drawAutoSize();
    $(window).resize(function () {
        drawAutoSize();
    });
});
